  function loginValidation() {
	
	var form = document.forms["login"];
	
	var loginReg = /^[a-zA-Z0-9]{3,30}$/;
	var passwordReg = /^[a-zA-Z0-9]{6,30}$/;
	
	var error = "niepoprawny login lub haslo";
	var correct = true;
	
	if(form.login.value.match(loginReg) == null) correct = false;
	else if(form.password.value.match(passwordReg) == null) correct = false;
	
	if(!correct) document.getElementById("error").innerHTML = error;
	
	return correct;
	
}
 function registerValidation() {
		
	var form = document.forms["register"];
			
	var loginReg = /^[a-zA-Z0-9]{3,30}$/;
	var passwordReg = /^[a-zA-Z0-9]{6,30}$/;
	var mailReg = /^[a-zA-Z0-9.]+@[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)+$/;
		
	var login = "";
	var password = "";
	var mail= "";
		
	var correct = true;
		
	if(form.login.value.match(loginReg) == null){
			
		correct = false;
		login = "niewlasciwy login!";
	}
	
	if(form.mail.value.match(mailReg) == null){
		
		correct = false;
		mail = "niewlasciwy mail!";
	}
	
	if(form.password.value != form.password2.value) {
			
		correct = false;
		password = "hasla nie sa identyczne!";
	}
	
	else if(form.password.value.match(passwordReg) == null || form.password2.value.match(passwordReg) == null) {
			
		correct = false;
		password = "niepoprawne haslo!";
	}
		
	document.getElementById("loginE").innerHTML = login;	
	document.getElementById("passwordE").innerHTML = password;
	document.getElementById("mailE").innerHTML = mail;

	
	return correct;
}
		